#!/bin/sh

# JDBC - MySQL driver connector for Java
apt-get remove libmysql-java

# JDOM - Library for manipulating XML files
apt-get remove libjdom1-java

INSTALL_DIR=$1
test -z $INSTALL_DIR && INSTALL_DIR=/opt/

INSTALL_DIR=$INSTALL_DIR/vmmjava
INSTALL_DIR=`echo $INSTALL_DIR | sed 's/\/\//\//g'`

rm -fR $INSTALL_DIR
rm -fR /etc/profile.d/vmmjava.sh

BINFILE=/usr/local/bin/vmmanager-server
rm -fR BINFILE

echo "Dropping database..."
echo "Please, type your root password for MySQL"
echo  "DROP database vmmanager; DROP USER 'vmmanager'@'localhost'; FLUSH PRIVILEGES;" > drop-vmmanager.sql
mysql --force -u root -p < drop-vmmanager.sql
rm drop-vmmanager.sql
